import { observable } from 'mobx';
import service from '../service/index';


const CourseLisStore = observable({
    title: 'this is login page',

    lastEntryPublishID: '',
    lastEntryCourseID: '',

    pulishList: [],
    gradeList: [],

    activeIndex: -1,

    // 获取出版社
    async GetPublishList() {
        this.pulishList = await service.GetPublishList();
        // this.pulishList = this.pulishList.concat(this.pulishList);
        // this.pulishList = this.pulishList.concat(this.pulishList);

        this.gradeList.forEach((item, index) => {
            if (item.DirectoryID == this.lastEntryPublishID) {
                this.activeIndex = index;
            }
        })

    },


    // 获取教材
    async GetGradeListById(directoryId) {
        directoryId = directoryId || "D92C7917-1A31-48B0-BCF5-A4A70148DB2B";
        this.gradeList = await service.GetGradeListById(directoryId);

        // this.gradeList=this.gradeList.concat(this.gradeList)

        // this.gradeList.forEach(x => x.ImageURL = ' http://www.besteasylearn.com/pic/book.png')


        console.log(this.gradeList, "==========this.gradeList========");
    }

});


export default CourseLisStore;